<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">

<body>
  <div th:fragment="sidebar">
    <nav class="navbar-default navbar-static-side" role="navigation">
      <div class="sidebar-collapse">
        <ul class="nav metismenu" id="side-menu">
          <li class="nav-header" style="padding:0;">
            <a class="navbar-minimalize btn " style="font-size:12px !important;" href="javascript:;">
              <i class="fa fa-bars"></i>
            </a>
          </li>
          <li th:each="menu:${#lists.sort(menus)}" th:class="${#sets.contains(activeMenus, menu)?'active':''}"
            th:if="${isSuperAdmin || #sets.contains(grantedMenus,menu)}">
            <a th:href="${menu.url!=null?menu.url:'javascript:;'}">
              <i th:class="${#strings.isEmpty(menu.iconClass)?'fa fa-th':menu.iconClass}"></i>
              <span class="nav-label" th:text="${menu.title}"></span>
              <span class="fa arrow" th:if="${!menu.leaf}"></span>
            </a>
            <ul th:class="${#sets.contains(activeMenus, menu)?'nav nav-second-level':'nav nav-second-level collapse'}" th:if="${not #lists.isEmpty(menu.children)}">
              <li th:each="c : ${#lists.sort(#lists.toList(menu.children))}" th:class="${#sets.contains(activeMenus, c)?'active':''}" th:if="${isSuperAdmin || #sets.contains(grantedMenus,c)}">
                <a th:href="@{|${c.url}|}">
                  <i th:class="${#strings.isEmpty(c.iconClass)?'fa fa-th':c.iconClass}"></i>
                  [[${c.title}]]
                  <span class="fa arrow" th:if="${not #lists.isEmpty(c.children)}"></span>
                </a>
                <ul th:class="${#sets.contains(activeMenus, c)?'nav nav-third-level':'nav nav-third-level collapse'}" th:if="${not #lists.isEmpty(c.children)}">
                  <li th:each="cc : ${#lists.sort(#lists.toList(c.children))}" th:class="${#sets.contains(activeMenus, cc)?'active':''}" th:if="${isSuperAdmin || #sets.contains(grantedMenus,cc)}">
                    <a th:href="@{|${cc.url}${#strings.contains(cc.url,'?')?'&':'?'}menuId=${cc.id}|}">
                      <i th:class="${#strings.isEmpty(cc.iconClass)?'fa fa-th':cc.iconClass}"></i>
                      [[${cc.title}]]
                    </a>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
        </ul>
      </div>
    </nav>
  </div>
</body>

</html>
